// zizhi
	(function(e) {
	function u(u) {
		function c() {
			function h(e) {
				e.show();
				n.removeClass("loading")
			}
			var t = e(this),
				r = parseInt(n.css("borderLeftWidth")),
				i = s - r * 2,
				u = o - r * 2,
				a = t.width(),
				f = t.height();
			if (a == n.width() && a <= i && f == n.height() && f <= u) {
				h(t);
				return
			}
			if (a > i || f > u) {
				var l = u < f ? u : f,
					c = i < a ? i : a;
				if (l / f <= c / a) {
					t.width(a * l / f);
					t.height(l)
				} else {
					t.width(c);
					t.height(f * c / a)
				}
			}
			n.animate({
				width: t.width(),
				height: t.height(),
				marginTop: -(t.height() / 2) - r,
				marginLeft: -(t.width() / 2) - r
			}, 200, function() {
				h(t)
			})
		}
		if (u) u.preventDefault();
		var a = e(this),
			f = a.attr("href");
			img_title = a.attr("title");
			
		if (!f) return;
		var l = e(new Image).hide();
		e("#zoom .previous, #zoom .next").show();
		if (a.hasClass("zoom")) e("#zoom .previous, #zoom .next").hide();
		if (!r) {
			r = true;
			t.show();
			e("body").addClass("zoomed")
		}
		n.html(l).delay(500).addClass("loading");
		l.load(c).attr("src", f);
		l.load(c).attr("title", img_title);
		l.load(function(){
		  $("#img_title").text(img_title);
		});
		i = a
	}
	function a() {
		var t = i.parent("li").prev();
		if (t.length == 0) t = e(".gallery li:last-child");
		t.find("a").trigger("click")
	}
	function f() {
		var t = i.parent("li").next();
		if (t.length == 0) t = e(".gallery li:first-child");
		t.children("a").trigger("click")
	}
	function l(s) {
		if (s) s.preventDefault();
		r = false;
		i = null;
		t.hide();
		e("body").removeClass("zoomed");
		n.empty()
	}
	function c() {
		s = e(window).width();
		o = e(window).height()
	}
	e("body").append('<div id="zoom"><div id="img_title"></div> <a class="close"></a><a href="#previous" class="previous"></a><a href="#next" class="next"></a><div class="content loading" > </div></div>');
	var t = e("#zoom").hide(),
		n = e("#zoom .content"),
		r = false,
		i = null,
		s = e(window).width(),
		o = e(window).height();
	(function() {
		t.on("click", function(t) {
			t.preventDefault();
			if (e(t.target).attr("id") == "zoom") l()
		});
		e("#zoom .close").on("click", l);
		e("#zoom .previous").on("click", a);
		e("#zoom .next").on("click", f);
		e(document).keydown(function(e) {
			if (!i) return;
			if (e.which == 38 || e.which == 40) e.preventDefault();
			if (e.which == 27) l();
			if (e.which == 37 && !i.hasClass("zoom")) a();
			if (e.which == 39 && !i.hasClass("zoom")) f()
		});
		if (e(".gallery li a").length == 1) e(".gallery li a")[0].addClass("zoom");
		e(".zoom, .gallery li a").on("click", u)
	})();
	(function() {
		e(window).on("resize", c)
	})();
	(function() {
		e(window).on("mousewheel DOMMouseScroll", function(e) {
			if (!i) return;
			e.stopPropagation();
			e.preventDefault();
			e.cancelBubble = false
		})
	})()
})(jQuery);


(function(a) {
    a.fn.DB_tabMotionBanner = function(b) {
        var c = {
            key: "",
            autoRollingTime: 3000,
            bgSpeed: 100,
            motion: ""
        };
        a.extend(c, b);
        return this.each(function() {
            var h = a(this);
            var k = h.find(".DB_imgSet");
            var r = h.find(".DB_imgSet li");
            var i = h.find(".DB_menuSet");
            var m = h.find(".DB_menuSet li");
            var e = h.find(".banner_bg li");
            var q = h.find(".DB_next");
            var g = h.find(".DB_prev");
            var f = r.length;
            var p = 0;
            var j = 0;
            s();
            function s() {
                
                l();
                d();
                t();
                o()
            }
            function l() {
                k.css({
                    position: "relative"
                });
                r.css({
                    position: "absolute"
                });
                for (var y = 0; y < f; y++) {
                    if (y == p) {
                        r.eq(y).show()
                    } else {
                        r.eq(y).hide()
                    }
                }
                for (var y = 0; y < r.length; y++) {
                    var x = r.eq(y).find("img");
                    for (var w = 0; w < x.length; w++) {
                        var A = x.eq(w);
                        var v = c.motion[A.attr("class")];
                        if (v != null) {
                            var z = Number(A.css("left").split("px")[0]);
                            var B = Number(A.css("top").split("px")[0]);
                            A.data({
                                x2: z,
                                y2: B,
                                x1: z + v.left,
                                y1: B + v.top,
                                opacity: v.opacity,
                                speed: v.speed,
                                delay: v.delay == null ? 0 : v.delay
                            })
                        }
                    }
                }
            }
            function d() {
                h.bind("mouseenter",
                function() {
                    clearInterval(j);
                    q.show();
                    g.show()
                });
                h.bind("mouseleave",
                function() {
                    t();
                    q.hide();
                    g.hide()
                });
                m.bind("click",
                function() {
                    if (a(this).index() != p) {
                        p = a(this).index();
                        o()
                    }
                });
                m.bind("mouseenter",
                function() {
                    n(a(this).find("img"), "src", "_off", "_on")
                });
                m.bind("mouseleave",
                function() {
                    if (p != a(this).index()) {
                        n(a(this).find("img"), "src", "_on", "_off")
                    }
                });
                q.bind("click",
                function() {
                    u()
                });
                g.bind("click",
                function() {
                    p--;
                    if (p == -1) {
                        p = f - 1
                    }
                    o()
                })
            }
            function u() {
                p = ++p % f;
                o()
            }
            function t() {
                j = setInterval(u, c.autoRollingTime)
            }
            function o() {
                for (var z = 0; z < r.length; z++) {
                    var A = r.eq(z);
                    var y = e.eq(z);
                    if (p == z) {
                        A.show();
                        var x = A.find("img");
                        for (var w = 0; w < x.length; w++) {
                            var A = x.eq(w);
                            var v = c.motion[A.attr("class")];
                            if (v != null) {
                                if (A.attr("src").indexOf(".png") > 0 && a.browser.msie && a.browser.version < 9) {
                                    A.css({
                                        left: A.data("x1"),
                                        top: A.data("y1"),
                                        opacity: 1,
                                        display: "none"
                                    })
                                } else {
                                    A.css({
                                        left: A.data("x1"),
                                        top: A.data("y1"),
                                        opacity: A.data("opacity")
                                    })
                                }
                                A.stop().delay(A.data("delay")).queue(function() {
                                    a(this).css("display", "block");
                                    a(this).dequeue()
                                }).animate({
                                    left: A.data("x2"),
                                    top: A.data("y2"),
                                    opacity: 1
                                },
                                A.data("speed"))
                            }
                        }
                        n(m.eq(z).find("img"), "src", "_off", "_on");
                        m.eq(z).addClass("select");
                        y.stop(true, true).fadeIn(c.bgSpeed)
                    } else {
                        A.hide();
                        n(m.eq(z).find("img"), "src", "_on", "_off");
                        m.eq(z).removeClass("select");
                        y.stop(true, true).fadeOut(c.bgSpeed)
                    }
                }
            }
            function n(w, z, v, x) {
                var y = w.attr(z);
                if (String(y).search(v) != -1) {
                    w.attr(z, y.replace(v, x))
                }
            }
        })
    }
})(jQuery);
